package face.yuque;

/**
 * @author spf
 * @date 2024/12/12
 * @time 21:45
 */
//斐波那契数列
//方法三：双指针
public class FBNQ3 {

    public static void main(String[] args) {
        System.out.println(fbnq(10));
    }

    private static int fbnq(int n) {
        int low = 0, high = 1;
        for (int i = 2; i <= n; i++) {
            int sum = low + high;
            low = high;
            high = sum;
        }
        return high;
    }

}
